/*
 * Copyright (C), 2014-2016, org.esaydev
 * FileName: SystemAPI.java
 * Author:   jian
 * Date:     2016年3月22日 
 */
package org.easydev.wechat.api;

import org.easydev.wechat.client.WechatClient;
import org.easydev.wechat.client.dto.base.ServiceIP;
import org.easydev.wechat.client.result.base.BaseWechatResult;
import org.easydev.wechat.common.exception.WechatException;

/**
 * <Description> 系统级API<br>
 * 
 * @author jian<br>
 */
public class SystemAPI {

    /**
     * 微信调用客户端
     */
    protected static WechatClient client = WechatClient.getInstance();

    /**
     * Description: 获取AcceccToken<br>
     * 
     * @return <br>
     * @throws WechatException <br>
     */
    public static String getAccessToken() throws WechatException {
        return client.getAcceccToken();
    }

    /**
     * Description: 获取服务器IP<br>
     * 
     * @return 若result.isSuccess(),结果对象是result.getData(ServerIPResult.class)<br>
     * @throws WechatException <br>
     */
    public static BaseWechatResult getServerIp() throws WechatException {
        return client.getFromWechat(new ServiceIP());
    }
}
